<?php
namespace frontend\controllers;

use common\models\Page;
use Yii;
use yii\base\NotSupportedException;
use yii\web\Controller;
use yii\web\NotFoundHttpException;


/**
 * Logincontroller
 */
class PageController extends Controller
{


    public function actionIndex($name)
    {
        if(!$name){
            throw new NotSupportedException("请求参数错误");

        }
        $model = Page::findOne(['name'=>$name]);
        if(!$model){
            throw new NotFoundHttpException("页面不存在");
        }

        return $this->render('index', [
            'model' => $model,
            'name' => $name,
        ]);
    }





}
